#ifndef _SPRITE_H_
#define _SPRITE_H_

#include <d3dx9.h>
#include <string>

using namespace std;

class CSprite
{
private:
	static LPD3DXSPRITE			SpriteHandler_;
	static LPDIRECT3DDEVICE9	d3dDevice_;

	int					nRows_;
	int					nColumns_;
	int					nFrames_;
	int					Index_;
	D3DXIMAGE_INFO		Info_;
	D3DXIMAGE_INFO		FrameInfo_;
	LPDIRECT3DTEXTURE9	Image_;
public:
	CSprite(wstring filePath, int nRows, int nColumns, int nFrames, int Index = 0);
	~CSprite(void);

	bool Render(int from		= 0,
				int to			= -1,
				D3DXVECTOR3 Position = D3DXVECTOR3(0,0,0.5));
	RECT getScrRect();
	D3DXVECTOR3 correctImagePosition(D3DXVECTOR3 Position);
	static void initializeSpriteHandler(LPD3DXSPRITE spriteHandler);
};

#endif